﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows;

namespace EIA.SLClient.Utility.Converters
{
    public class NotNull2VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (parameter != null && Consts.InversionTags.Contains(parameter.ToString().Trim().ToLower()))
            {
                return value != null ? Visibility.Collapsed : Visibility.Visible;
            }
            else
            {
                return value != null ? Visibility.Visible : Visibility.Collapsed;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new InvalidOperationException("Converter can not convert back");
        }
    }
}
